using System;
using System.Collections.Generic;
using System.Text;

namespace Chapter10CustomControlsCS
{
    [System.Web.UI.WebControls.WebParts.WebPartTransformer(typeof(IBookInfo), typeof(IAuthorInfo))]
    public class BookToAuthorTransform :
            System.Web.UI.WebControls.WebParts.WebPartTransformer, IAuthorInfo
        
    {
        IBookInfo ibk;
        public override object Transform(object providerData)
        {
            ibk = (IBookInfo)providerData;
            return this;
        }

        int IAuthorInfo.ISBN
        {
            get
            {
                if (ibk != null)
                {
                    return Convert.ToInt32(ibk.ISBN);
                }
                else
                {
                    return 0;
                }
            }

            set
            {
                ibk.ISBN = value.ToString();
            }
        }
    }
}
